package BehavioralPatterns.Command;

public class Test {

  public static void main(String[] args) {

//    遥控器
    RemoteController remoteController = new RemoteController();
//    命令接受者
    LightReceiver lightReceiver = new LightReceiver();
//    命令
    LightOnCommand lightOnCommand = new LightOnCommand(lightReceiver);
    LightOffCommand lightOffCommand = new LightOffCommand(lightReceiver);

    remoteController.setCommands(0,lightOnCommand,lightOffCommand);
    System.out.println("===按下打开按钮===");
    remoteController.onButtonWasPush(0);
    System.out.println("===按下关闭按钮===");
    remoteController.offButtonWasPush(0);
    System.out.println("===按下撤销按钮===");
    remoteController.undoButtonWasPush();

    DVDReceiver dvdReceiver = new DVDReceiver();
    DVDOn dvdOn = new DVDOn(dvdReceiver);
    DVDOff dvdOff = new DVDOff(dvdReceiver);
    remoteController.setCommands(3,dvdOn,dvdOff);
    remoteController.offButtonWasPush(3);
    remoteController.onButtonWasPush(3);

    remoteController.undoButtonWasPush();
  }
}
